home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / lib / python2.5 / sqlite3 / dbapi2.pyc (.txt) < prev   
Python Compiled Bytecode  |  2008-10-29  |  3KB  |  62 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.5)
  3.  
  4. import datetime
  5. import time
  6. from _sqlite3 import *
  7. paramstyle = 'qmark'
  8. threadsafety = 1
  9. apilevel = '2.0'
  10. Date = datetime.date
  11. Time = datetime.time
  12. Timestamp = datetime.datetime
  13.  
  14. def DateFromTicks(ticks):
  15.     return apply(Date, time.localtime(ticks)[:3])
  16.  
  17.  
  18. def TimeFromTicks(ticks):
  19.     return apply(Time, time.localtime(ticks)[3:6])
  20.  
  21.  
  22. def TimestampFromTicks(ticks):
  23.     return apply(Timestamp, time.localtime(ticks)[:6])
  24.  
  25. version_info = []([ int(x) for x in version.split('.') ])
  26. sqlite_version_info = []([ int(x) for x in sqlite_version.split('.') ])
  27. Binary = buffer
  28.  
  29. def register_adapters_and_converters():
  30.     
  31.     def adapt_date(val):
  32.         return val.isoformat()
  33.  
  34.     
  35.     def adapt_datetime(val):
  36.         return val.isoformat(' ')
  37.  
  38.     
  39.     def convert_date(val):
  40.         return datetime.date(*map(int, val.split('-')))
  41.  
  42.     
  43.     def convert_timestamp(val):
  44.         (datepart, timepart) = val.split(' ')
  45.         (year, month, day) = map(int, datepart.split('-'))
  46.         timepart_full = timepart.split('.')
  47.         (hours, minutes, seconds) = map(int, timepart_full[0].split(':'))
  48.         if len(timepart_full) == 2:
  49.             microseconds = int(float('0.' + timepart_full[1]) * 1000000)
  50.         else:
  51.             microseconds = 0
  52.         val = datetime.datetime(year, month, day, hours, minutes, seconds, microseconds)
  53.         return val
  54.  
  55.     register_adapter(datetime.date, adapt_date)
  56.     register_adapter(datetime.datetime, adapt_datetime)
  57.     register_converter('date', convert_date)
  58.     register_converter('timestamp', convert_timestamp)
  59.  
  60. register_adapters_and_converters()
  61. del register_adapters_and_converters
  62.